package com.tuanzi.loan.business.entity.system;

import com.tuanzi.loan.core.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Range;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

/**
 * @author Ray 2017/09/21
 */

@Data
@Entity
@Table(name = "TB_LOAN_MENU")
@EqualsAndHashCode(callSuper = true)
public class Menu extends BaseEntity {

    private static final long serialVersionUID = -9187754109889244573L;

    @Id
    @GeneratedValue(generator = "uuid2")
    @GenericGenerator(name = "uuid2", strategy = "org.hibernate.id.UUIDGenerator")
    private String id;

    @NotBlank
    @Length(max = 200)
    @Column(name = "CODE")
    private String code;

    @NotNull
    @Column(name = "SORT")
    @Range(min = 0, max = Integer.MAX_VALUE)
    private Integer sort;

    @Length(max = 36)
    @Column(name = "PARENT_ID")
    private String parentId;

    @NotBlank
    @Length(max = 200)
    @Column(name = "TITLE")
    private String title;

    @NotBlank
    @Length(max = 200)
    @Column(name = "PERMISSION_CODE")
    private String permissionCode;

    @Length(max = 200)
    @Column(name = "URL")
    private String url;

    @Length(max = 200)
    @Column(name = "ICON")
    private String icon;

    @Column(name = "LEAF")
    private Boolean leaf;

}
